USE [Capstone]
GO

/****** Object:  StoredProcedure [dbo].[GetVacCount]    Script Date: 07/22/2012 22:27:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[GetVacCount] 
	-- Add the parameters for the stored procedure here
	@UserID int,
	@StartDate datetime,
	@EndDate datetime
	
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	 SELECT 
 Count(*) VacCount
 From 
  CalendarDetails a 
 Inner Join
  Calendar b on
  a.calID = b.calID
 Where 
  b.UserID=2
 And
 a.Date between Cast(@StartDate as DateTime) and Cast (@EndDate as DateTime)
 and b.StatusID=3
END

GO

